loaderState<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="客户姓名" prop="loaderName">
        <el-input
          v-model="queryParams.loaderName"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="贷款类型" prop="loadType">
        <el-select v-model="queryParams.loadType" placeholder="" clearable>
          <el-option
            v-for="dict in dict.type.crm_load_type"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="贷款进度" prop="loadProgress">
        <el-select v-model="queryParams.loadProgress" placeholder="" clearable>
          <el-option
            v-for="dict in dict.type.crm_load_progress"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="客户状态" prop="loaderState">
        <el-select v-model="queryParams.loaderState" placeholder="" clearable>
          <el-option
            v-for="dict in loaderStateOptions"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item> -->
      <el-form-item label="客户星级" prop="loaderStart">
        <el-select v-model="queryParams.loaderStart" placeholder="" clearable>
          <el-option
            v-for="dict in loaderStartOptions"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="状态" prop="delFlag">
        <el-select v-model="queryParams.delFlag" placeholder="" clearable>
          <el-option
            v-for="dict in delFlagOptions"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['crm:customer:add']"
          >添加客户</el-button
        >
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['crm:customer:remove']"
          >删除</el-button
        >
      </el-col>
    </el-row>

    <el-table
      v-loading="loading"
      :data="customerList"
      @selection-change="handleSelectionChange"
      @row-click="rowClick"
    >
      <el-table-column type="selection" align="center" />
      <el-table-column
        label="客户姓名"
        align="center"
        prop="loaderName"
        fixed="left"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            @click="handleUpdate(scope.row)"
            v-show="scope.row.delFlag != '2'"
            v-hasPermi="['crm:customer:edit']"
            >{{ scope.row.loaderName }}</el-button
          ></template
        ></el-table-column
      >

      <el-table-column label="贷款类型" align="center" prop="loadType">
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.crm_load_type"
            :value="scope.row.loadType"
          />
        </template>
      </el-table-column>
      <el-table-column label="贷款进度" align="center" prop="loadProgress">
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.crm_load_progress"
            :value="scope.row.loadProgress"
          />
        </template>
      </el-table-column>
      <el-table-column label="放款银行" align="center" prop="bank.bankName">
      </el-table-column>
      <el-table-column label="贷款金额" align="center" prop="loadAmount" />
      <el-table-column
        label="归属部门"
        align="center"
        key="deptName"
        prop="dept.deptName"
      />
      <el-table-column
        label="客户经理"
        align="center"
        key="nickName"
        prop="user.nickName"
      />
      <el-table-column label="是否还款" align="center" prop="loadRepayRecall">
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.crm_load_repay_recall"
            :value="scope.row.loadRepayRecall"
          />
        </template>
      </el-table-column>
      <el-table-column label="提醒日期" align="center" prop="loadReminderTime">
        <template slot-scope="scope">
          <span
            v-if="
              scope.row.loadRepayRecall != '1' &&
              compareDate(scope.row.loadReminderTime) < 0
            "
          >
            <el-tag type="danger">
              超期{{ -compareDate(scope.row.loadReminderTime) }}天
            </el-tag></span
          >

          <span
            v-if="
              scope.row.loadRepayRecall != '1' &&
              compareDate(scope.row.loadReminderTime) >= 0
            "
          >
            <el-tag>
              剩余{{ compareDate(scope.row.loadReminderTime) }}天
            </el-tag></span
          >

          <span>
            <el-tag v-if="scope.row.loadRepayRecall == '1'" type="success"
              >已还</el-tag
            >
          </span>
        </template>
      </el-table-column>
      <el-table-column
        label="客户星级"
        align="center"
        prop="loaderStart"
        width="120"
      >
        <template slot-scope="scope">
          <el-rate disabled v-model="scope.row.loaderStart" :max="4"></el-rate
        ></template>
      </el-table-column>
      <el-table-column label="客户状态" align="center" prop="loaderState">
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.crm_loader_state"
            :value="scope.row.loaderState"
          />
        </template>
      </el-table-column>
      <el-table-column label="状态" align="center" prop="delFlag">
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.crm_customer_del_flag"
            :value="scope.row.delFlag"
          />
        </template>
      </el-table-column>
      <el-table-column label="更新人" align="center" prop="updateBy" />
      <el-table-column
        label="更新时间"
        align="center"
        prop="updateTime"
        width="100"
      />
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
        fixed="right"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-show="scope.row.delFlag != '2'"
            v-hasPermi="['crm:customer:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-show="scope.row.delFlag != '2'"
            v-hasPermi="['crm:customer:remove']"
            >删除</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-refresh-left"
            @click="handleRecover(scope.row)"
            v-hasRole="['system']"
            v-show="scope.row.delFlag == '2'"
            >恢复</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <el-dialog
      :title="title"
      :visible.sync="open"
      width="80%"
      :close-on-click-modal="false"
      class="abow_dialog"
      :lock-scroll="false"
      :append-to-body="true"
    >
      <div class="roll-dialog">
        <el-form
          ref="form"
          :rules="rules"
          :model="form"
          label-width="120px"
          class="crm"
        >
          <el-tabs v-model="activeName">
            <el-tab-pane name="first">
              <span slot="label"><i class="el-icon-sunny"></i> 客户信息</span>
              <span class="form-title" style="margin-top: 0"> 基本信息 </span>

              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="客户星级">
                    <el-rate v-model="form.loaderStart" :max="4"></el-rate>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="11"></el-col>
              </el-row>

              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="客户经理">
                    <el-tag>
                      <span v-if="form.user">{{ form.user.nickName }}</span>
                      <span v-if="form.dept">（{{ form.dept.deptName }}）</span>
                    </el-tag>
                    <el-button
                      type="primary"
                      @click="
                        (loadBelongPerson = null),
                          (loadBelongDepartment = null),
                          (innerVisible = true)
                      "
                      size="mini"
                      class="editBelong"
                      >选择客户经理</el-button
                    >
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="11">
                  <el-form-item label="客户状态">
                    <el-select
                      v-model="form.loaderState"
                      placeholder=""
                      clearable
                      style="width: 100%"
                    >
                      <el-option
                        v-for="dict in dict.type.crm_loader_state"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item prop="loaderName" label="客户姓名" required>
                    <el-input
                      v-model="form.loaderName"
                      :disabled="inputDisable"
                    >
                    </el-input>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11">
                  <el-form-item
                    label="联系方式"
                    :inline="true"
                    prop="loaderContactInformation"
                  >
                    <el-input v-model="form.loaderContactInformation">
                      <el-button
                        slot="append"
                        icon="el-icon-search"
                        @click="checkTel(form.id, 1)"
                      ></el-button
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="身份证号" prop="loaderIdNumber">
                    <el-input v-model="form.loaderIdNumber"></el-input>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11">
                  <el-form-item label="家庭住址">
                    <el-input v-model="form.loaderAddress"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="客户年龄">
                    <el-date-picker
                      style="width: 100%"
                      value-format="yyyy"
                      v-model="form.loaderAge"
                      type="year"
                      placeholder=""
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11">
                  <el-form-item label="孩子年龄">
                    <el-date-picker
                      style="width: 100%"
                      value-format="yyyy"
                      v-model="form.loaderChildAge"
                      type="year"
                      placeholder=""
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="工作">
                    <el-select
                      v-model="form.loaderCompany"
                      placeholder=""
                      clearable
                      style="width: 100%"
                    >
                      <el-option
                        v-for="dict in dict.type.crm_loader_company"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11">
                  <el-form-item label="单位名称">
                    <el-input v-model="form.loaderCompanyName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="打卡工资">
                    <el-input v-model="form.loaderSalary"></el-input>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11">
                  <el-form-item label="公积金月缴额">
                    <el-input v-model="form.loaderHouseFund"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <div class="form-title">业务信息</div>

              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="收佣">
                    <el-input v-model="form.loadCommission"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="11">
                  <el-form-item label="来源">
                    <el-input v-model="form.loadSource"></el-input>
                  </el-form-item> </el-col
              ></el-row>

              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="贷款金额">
                    <el-input v-model="form.loadAmount"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="11">
                  <el-form-item label="贷款年限">
                    <el-input v-model="form.loadLife"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="贷款月供">
                    <el-input v-model="form.loadMonthPay"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="11">
                  <!-- <el-form-item label="备注">
                    <el-input v-model="form.loadRemark"></el-input>
                  </el-form-item> -->
                  <el-form-item label="贷款类型">
                    <el-select
                      v-model="form.loadType"
                      placeholder=""
                      clearable
                      style="width: 100%"
                    >
                      <el-option
                        v-for="dict in dict.type.crm_load_type"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="成交日期">
                    <el-date-picker
                      v-model="form.loadStartDay"
                      type="date"
                      value-format="yyyy-MM-dd"
                      placeholder=""
                      align="right"
                      style="width: 100%"
                      :picker-options="pickerOptions"
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="11">
                  <el-form-item label="提醒日期">
                    <el-date-picker
                      v-model="form.loadReminderTime"
                      type="date"
                      value-format="yyyy-MM-dd"
                      placeholder=""
                      align="right"
                      style="width: 100%"
                      :picker-options="pickerOptions"
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="贷款进度">
                    <el-select
                      v-model="form.loadProgress"
                      placeholder=""
                      clearable
                      style="width: 100%"
                    >
                      <el-option
                        v-for="dict in dict.type.crm_load_progress"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="11">
                  <el-form-item label="还款方式">
                    <el-select
                      v-model="form.loadRepayWay"
                      placeholder=""
                      clearable
                      style="width: 100%"
                    >
                      <el-option
                        v-for="dict in dict.type.crm_load_repay_way"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
              </el-row>

              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="是否还款">
                    <el-select
                      v-model="form.loadRepayRecall"
                      placeholder=""
                      clearable
                      style="width: 100%"
                    >
                      <el-option
                        v-for="dict in dict.type.crm_load_repay_recall"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="11">
                  <el-form-item label="放款银行">
                    <el-select v-model="form.loadBank" style="width: 100%">
                      <el-option
                        v-for="item in bankOptions"
                        :key="item.bankId + ''"
                        :label="item.bankName"
                        :value="item.bankId + ''"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :xs="24" :sm="11"> </el-col>
              </el-row>

              <el-row :gutter="10" style="margin-top: 20px">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="备注">
                    <el-input
                      v-model="form.loaderRemark"
                      type="textarea"
                      :autosize="{ minRows: 2, maxRows: 4 }"
                      maxlength="100"
                      show-word-limit
                    ></el-input>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11"> </el-col>
              </el-row>
            </el-tab-pane>

            <el-tab-pane name="second">
              <span slot="label"><i class="el-icon-moon"></i> 配偶信息</span>
              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item prop="wifeName" label="配偶姓名">
                    <el-input v-model="form.wifeName"> </el-input>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11">
                  <el-form-item
                    label="联系方式"
                    :inline="true"
                    prop="wifeContactInformation"
                  >
                    <el-input v-model="form.wifeContactInformation">
                      <el-button
                        slot="append"
                        icon="el-icon-search"
                        @click="checkTel(form.id, 0)"
                      ></el-button
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="身份证号" prop="wifeIdNumber">
                    <el-input v-model="form.wifeIdNumber"></el-input>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11">
                  <el-form-item label="家庭住址">
                    <el-input v-model="form.wifeAddress"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="配偶年龄">
                    <el-date-picker
                      style="width: 100%"
                      value-format="yyyy"
                      v-model="form.wifeAge"
                      type="year"
                      placeholder=""
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11">
                  <el-form-item label="孩子年龄">
                    <el-date-picker
                      style="width: 100%"
                      value-format="yyyy"
                      v-model="form.wifeChildAge"
                      type="year"
                      placeholder=""
                    >
                    </el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="工作">
                    <el-select
                      v-model="form.wifeCompany"
                      placeholder=""
                      clearable
                      style="width: 100%"
                    >
                      <el-option
                        v-for="dict in dict.type.crm_loader_company"
                        :key="dict.value"
                        :label="dict.label"
                        :value="dict.value"
                      />
                    </el-select>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11">
                  <el-form-item label="单位名称">
                    <el-input v-model="form.wifeCompanyName"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="10">
                <el-col :xs="24" :sm="11">
                  <el-form-item label="打卡工资">
                    <el-input v-model="form.wifeSalary"></el-input>
                  </el-form-item>
                </el-col>

                <el-col :xs="24" :sm="11">
                  <el-form-item label="公积金月缴额">
                    <el-input v-model="form.wifeHouseFund"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-tab-pane>
            <el-tab-pane name="third">
              <span slot="label"><i class="el-icon-moon"></i> 资产信息</span>
              <div class="form-title" style="margin-top: 0">房产</div>

              <div
                v-for="(item, index) in loaderPropertyAddress"
                :key="'0' + index"
                style="margin-bottom: 20px"
              >
                <el-row type="flex">
                  <el-col :xs="20" :sm="22">
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item>
                          <span slot="label">房产地址</span>
                          <el-input
                            v-model="loaderPropertyAddress[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="12">
                        <el-form-item label="面积(m²)">
                          <el-input
                            v-model="loaderPropertyAddressArea[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item label="竣工年限">
                          <el-date-picker
                            style="width: 100%"
                            value-format="yyyy"
                            v-model="loaderPropertyCompletedYears[index]"
                            type="year"
                            placeholder=""
                          >
                          </el-date-picker>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="12">
                        <el-form-item label="评估价值">
                          <el-input
                            v-model="loaderPropertyAssess[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item label="贷款银行">
                          <el-input
                            v-model="loaderPropertyLoadBank[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="12">
                        <el-form-item label="贷款金额">
                          <el-input
                            v-model="loaderPropertyLoadAmount[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-col>
                  <el-col
                    :xs="4"
                    :sm="2"
                    style="
                      display: flex;
                      flex-direction: column;
                      align-items: center;
                    "
                  >
                    <el-button
                      plain
                      type="primary"
                      style="margin-bottom: 10px"
                      v-if="index == 0"
                      size="mini"
                      @click="addField('loaderPropertyAddress')"
                    >
                      增加</el-button
                    >
                    <el-button
                      plain
                      type="danger"
                      style="margin-left: 0"
                      size="mini"
                      @click="delField('loaderPropertyAddress', index)"
                    >
                      删除</el-button
                    >
                  </el-col>
                </el-row>
              </div>

              <div class="form-title">车辆</div>

              <div
                v-for="(item, index) in loaderCarLoadAmount"
                :key="'1' + index"
                style="margin-bottom: 20px"
              >
                <el-row type="flex">
                  <el-col :xs="20" :sm="22">
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item>
                          <span slot="label">车贷金额</span>
                          <el-input
                            v-model="loaderCarLoadAmount[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="12">
                        <el-form-item label="银行名称">
                          <el-input
                            v-model="loaderCarLoadBank[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item label="月供">
                          <el-input
                            v-model="loaderCarLoadMonthPay[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="12"> </el-col>
                    </el-row>
                  </el-col>
                  <el-col
                    :xs="4"
                    :sm="2"
                    style="
                      display: flex;
                      flex-direction: column;
                      align-items: center;
                    "
                  >
                    <el-button
                      plain
                      type="primary"
                      style="margin-bottom: 10px"
                      v-if="index == 0"
                      size="mini"
                      @click="addField('loaderCarLoadAmount')"
                    >
                      增加</el-button
                    >
                    <el-button
                      plain
                      type="danger"
                      style="margin-left: 0"
                      size="mini"
                      @click="delField('loaderCarLoadAmount', index)"
                    >
                      删除</el-button
                    >
                  </el-col>
                </el-row>
              </div>

              <div class="form-title">房贷</div>

              <div
                v-for="(item, index) in loaderHouseLoadType"
                :key="'2' + index"
                style="margin-bottom: 20px"
              >
                <el-row type="flex">
                  <el-col :xs="20" :sm="22">
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item label="类型">
                          <span slot="label">类型</span>
                          <el-select
                            v-model="loaderHouseLoadType[index]"
                            placeholder=""
                            clearable
                            style="width: 100%"
                          >
                            <el-option
                              v-for="dict in dict.type
                                .crm_loader_house_load_type"
                              :key="dict.value"
                              :label="dict.label"
                              :value="dict.value"
                            />
                          </el-select>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="12">
                        <el-form-item label="房贷金额">
                          <el-input
                            v-model="loaderHouseLoadAmount[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item label="银行名称">
                          <el-input
                            v-model="loaderHouseLoadBank[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="12">
                        <el-form-item label="月供">
                          <el-input
                            v-model="loaderHouseLoadMouthPay[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-col>
                  <el-col
                    :xs="4"
                    :sm="2"
                    style="
                      display: flex;
                      flex-direction: column;
                      align-items: center;
                    "
                  >
                    <el-button
                      plain
                      type="primary"
                      style="margin-bottom: 10px"
                      v-if="index == 0"
                      size="mini"
                      @click="addField('loaderHouseLoadType')"
                    >
                      增加</el-button
                    >
                    <el-button
                      plain
                      type="danger"
                      style="margin-left: 0"
                      size="mini"
                      @click="delField('loaderHouseLoadType', index)"
                    >
                      删除</el-button
                    >
                  </el-col>
                </el-row>
              </div>

              <div class="form-title">信用</div>

              <div
                v-for="(item, index) in loaderCreditLoadAmount"
                :key="'3' + index"
                style="margin-bottom: 20px"
              >
                <el-row type="flex">
                  <el-col :xs="20" :sm="22">
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item label="金额">
                          <span slot="label">金额</span>
                          <el-input
                            v-model="loaderCreditLoadAmount[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="12">
                        <el-form-item label="银行名称">
                          <el-input
                            v-model="loaderCreditLoadBank[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item label="月供">
                          <el-input
                            v-model="loaderCreditLoadMonthPay[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="12"> </el-col>
                    </el-row>
                  </el-col>
                  <el-col
                    :xs="4"
                    :sm="2"
                    style="
                      display: flex;
                      flex-direction: column;
                      align-items: center;
                    "
                  >
                    <el-button
                      plain
                      type="primary"
                      style="margin-bottom: 10px"
                      v-if="index == 0"
                      size="mini"
                      @click="addField('loaderCreditLoadAmount')"
                    >
                      增加</el-button
                    >
                    <el-button
                      plain
                      type="danger"
                      style="margin-left: 0"
                      size="mini"
                      @click="delField('loaderCreditLoadAmount', index)"
                    >
                      删除</el-button
                    >
                  </el-col>
                </el-row>
              </div>

              <div class="form-title">信用卡</div>

              <div
                v-for="(item, index) in loaderCreditCardLoadLimit"
                :key="'4' + index"
                style="margin-bottom: 20px"
              >
                <el-row type="flex">
                  <el-col :xs="20" :sm="22">
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item>
                          <span slot="label">额度</span>
                          <el-input
                            v-model="loaderCreditCardLoadLimit[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="12">
                        <el-form-item label="使用额度">
                          <el-input
                            v-model="loaderCreditCardUsed[index]"
                          ></el-input>
                        </el-form-item>
                      </el-col> </el-row
                  ></el-col>
                  <el-col
                    :xs="4"
                    :sm="2"
                    style="
                      display: flex;
                      flex-direction: column;
                      align-items: center;
                    "
                  >
                    <el-button
                      plain
                      type="primary"
                      style="margin-bottom: 10px"
                      v-if="index == 0"
                      size="mini"
                      @click="addField('loaderCreditCardLoadLimit')"
                    >
                      增加</el-button
                    >
                    <el-button
                      plain
                      type="danger"
                      style="margin-left: 0"
                      size="mini"
                      @click="delField('loaderCreditCardLoadLimit', index)"
                    >
                      删除</el-button
                    >
                  </el-col>
                </el-row>
              </div>

              <div class="form-title">保险</div>
              <el-row type="flex">
                <el-col :xs="20" :sm="22">
                  <div
                    v-for="(item, index) in loaderIsInsurance"
                    :key="'1' + index"
                  >
                    <el-row>
                      <el-col :xs="24" :sm="12">
                        <el-form-item label="保险">
                          <el-select
                            v-model="loaderIsInsurance[index]"
                            placeholder=""
                            clearable
                            style="width: 100%"
                          >
                            <el-option
                              v-for="dict in dict.type.crm_loader_is_insurance"
                              :key="dict.value"
                              :label="dict.label"
                              :value="dict.value"
                            />
                          </el-select>
                        </el-form-item>
                      </el-col>

                      <el-col :xs="24" :sm="11"> </el-col>
                    </el-row>
                  </div>
                </el-col>
                <el-col
                  :xs="4"
                  :sm="2"
                  style="
                    display: flex;
                    justify-content: center;
                    align-items: center;
                  "
                >
                </el-col
              ></el-row>
            </el-tab-pane>
          </el-tabs>
        </el-form>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>

      <el-dialog
        width="30%"
        title="选择客户经理"
        :visible.sync="innerVisible"
        append-to-body
      >
        <el-form>
          <el-form-item label="部门">
            <treeselect
              v-model="loadBelongDepartment"
              :options="deptOptions"
              :show-count="true"
              placeholder=""
              @select="deptChange"
              defaultExpandLevel="10"
          /></el-form-item>
          <el-form-item label="客户经理">
            <treeselect
              v-model="loadBelongPerson"
              :options="userList"
              :show-count="true"
              placeholder=""
              :normalizer="normalizer"
            />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitInserDialog">确 定</el-button>
          <el-button @click="innerVisible = false">取 消</el-button>
        </div>
      </el-dialog>
    </el-dialog>
  </div>
</template>

<script>
import {
  listUser,
  getUser,
  delUser,
  addUser,
  updateUser,
  resetUserPwd,
  changeUserStatus,
  deptTreeSelect,
} from "@/api/system/user";
import {
  listBank,
  getBank,
  delBank,
  addBank,
  updateBank,
} from "@/api/crm/bank";
import {
  listCustomer,
  getCustomer,
  delCustomer,
  addCustomer,
  updateCustomer,
  getCheckTel,
} from "@/api/crm/customer";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
  name: "RuoyiUiIndex1",
  dicts: [
    "crm_load_type",
    "crm_load_progress",
    "crm_load_repay_way",
    "crm_load_repay_recall",
    "crm_load_bank",
    "crm_customer_del_flag",
    "crm_loader_company",
    "crm_loader_is_insurance",
    "crm_loader_is_car",
    "crm_loader_is_house_load",
    "crm_loader_is_credit_load",
    "crm_loader_is_credit_card",
    "crm_loader_house_load_type",
    "crm_loader_property_is_load",
    "crm_loader_state",
  ],
  components: { Treeselect },
  data() {
    var validator = (rule, value, callback) => {
      let phoneReg =
        /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
      if (value == "" || value == null || value == undefined) {
        callback();
      } else {
        console.log(value.indexOf("****"));
        if (value.indexOf("****") == 3 && value.length == 11) {
          callback();
        } else {
          if (!phoneReg.test(value)) {
            callback(new Error());
          } else {
            callback();
          }
        }
      }
    };

    var loaderIdNumber = (rule, value, callback) => {
      let reg =
        /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
      if (value == "" || value == null || value == undefined) {
        callback();
      } else {
        if (reg.test(value)) {
          callback();
        } else {
          callback(new Error());
        }
      }
    };

    return {
      // 表单校验
      rules: {
        loaderName: [
          { required: true, message: "请输入活动客户姓名", trigger: "blur" },
        ],
        loaderContactInformation: [{ validator, trigger: ["change", "blur"] }],
        loaderIdNumber: [
          { validator: loaderIdNumber, trigger: ["change", "blur"] },
        ],
        wifeContactInformation: [{ validator, trigger: ["change", "blur"] }],
      },

      loadBelongDepartment: null,
      loadBelongPerson: null,

      loadBelongDepartmentName: null,
      loadBelongPersonName: null,

      loaderPropertyAddress: [null],
      loaderPropertyAddressArea: [null],
      loaderPropertyCompletedYears: [null],
      loaderPropertyAssess: [null],
      loaderPropertyIsLoad: [null],
      loaderPropertyLoadAmount: [null],
      loaderPropertyLoadBank: [null],

      loaderDebt: [null],
      loaderIsInsurance: [null],

      loaderIsHouseLoad: [null],
      loaderHouseLoadType: [null],
      loaderHouseLoadAmount: [null],
      loaderHouseLoadBank: [null],
      loaderHouseLoadMouthPay: [null],

      loaderIsCreditLoad: [null],
      loaderCreditLoadAmount: [null],
      loaderCreditLoadBank: [null],
      loaderCreditLoadMonthPay: [null],

      loaderIsCar: [null],
      loaderCarLoadAmount: [null],
      loaderCarLoadBank: [null],
      loaderCarLoadMonthPay: [null],

      loaderIsCreditCard: [null],
      loaderCreditCardBank: [null],
      loaderCreditCardUsed: [null],
      loaderCreditCardLoadLimit: [null],

      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 客户信息表格数据
      customerList: [],
      // 用户表格数据
      userList: [],
      // 银行选项
      bankOptions: [],
      // 弹出层标题
      title: "",
      // 部门树选项
      deptOptions: undefined,
      // 是否显示弹出层
      open: false,
      innerVisible: false,
      activeName: "first",
      inputDisable: true,

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        loaderState: "2",
        loaderStart: null,
        loaderName: null,
        loaderContactInformation: null,
        loaderIdNumber: null,
        loaderAddress: null,
        loaderAge: null,
        loaderChildAge: null,
        loaderCompany: null,
        loaderCompanyName: null,
        loaderSalary: null,
        loaderHouseFund: null,
        loaderPropertyAddress: null,
        loaderPropertyAddressArea: null,
        loaderPropertyCompletedYears: null,
        loaderPropertyAssess: null,
        loaderPropertyIsLoad: null,
        loaderPropertyLoadAmount: null,
        loaderPropertyLoadBank: null,
        loaderDebt: null,
        loaderIsInsurance: null,
        loaderIsCar: null,
        loaderIsCreditLoad: null,
        loaderIsHouseLoad: null,
        loaderIsCreditCard: null,
        loaderHouseLoadType: null,
        loaderHouseLoadAmount: null,
        loaderHouseLoadBank: null,
        loaderHouseLoadMouthPay: null,
        loaderCreditLoadAmount: null,
        loaderCreditLoadBank: null,
        loaderCreditLoadMonthPay: null,
        loaderCarLoadAmount: null,
        loaderCarLoadBank: null,
        loaderCarLoadMonthPay: null,
        loaderCreditCardLoadLimit: null,
        loaderCreditCardBank: null,
        loaderCreditCardUsed: null,
        loaderRemark: null,
        loadFollow: null,
        loadCommission: null,
        loadReminderTime: null,
        loadBelongPerson: null,
        loadBelongDepartment: null,
        loadType: null,
        loadProgress: null,
        loadProgressRecall: null,
        loadReceive: null,
        loadSource: null,
        loadAmount: null,
        loadLife: null,
        loadRepayWay: null,
        loadMonthPay: null,
        loadBank: null,
        loadRepayDay: null,
        loadRepayRecall: null,
        loadRemark: null,
        wifeName: null,
        wifeContactInformation: null,
        wifeIdNumber: null,
        wifeAddress: null,
        wifeAge: null,
        wifeChildAge: null,
        wifeCompany: null,
        wifeCompanyName: null,
        wifeSalary: null,
        wifeHouseFund: null,
        wifePropertyAddress: null,
        wifePropertyAddressArea: null,
        wifePropertyCompletedYears: null,
        wifePropertyAssess: null,
        wifePropertyIsLoad: null,
        wifePropertyLoadAmount: null,
        wifePropertyLoadBank: null,
        wifeDebt: null,
        wifeIsInsurance: null,
        wifeIsCar: null,
        wifeIsCreditLoad: null,
        wifeIsHouseLoad: null,
        wifeIsCreditCard: null,
        wifeHouseLoadType: null,
        wifeHouseLoadAmount: null,
        wifeHouseLoadBank: null,
        wifeHouseLoadMouthPay: null,
        wifeCreditLoadAmount: null,
        wifeCreditLoadBank: null,
        wifeCreditLoadMonthPay: null,
        wifeCarLoadAmount: null,
        wifeCarLoadBank: null,
        wifeCarLoadMonthPay: null,
        wifeCreditCardLoadLimit: null,
        wifeCreditCardBank: null,
        wifeCreditCardUsed: null,
        wifeRemark: null,
        delFlag: "0",
      },
      // 表单参数
      form: {},
      delFlagOptions: [
        {
          value: "0",
          label: "正常",
        },
        {
          value: "2",
          label: "删除",
        },
      ],
      loaderStateOptions: [
        {
          value: "0",
          label: "意向",
        },
        {
          value: "1",
          label: "进行",
        },
        {
          value: "2",
          label: "成交",
        },
      ],
      loaderStartOptions: [
        {
          value: 1,
          label: 1,
        },
        {
          value: "2",
          label: "2",
        },
        {
          value: "3",
          label: "3",
        },
        {
          value: "4",
          label: "4",
        },
      ],
      array: [
        "loaderPropertyAddress",
        "loaderPropertyAddressArea",
        "loaderPropertyCompletedYears",
        "loaderPropertyAssess",
        "loaderPropertyIsLoad",
        "loaderPropertyLoadAmount",
        "loaderPropertyLoadBank",
        "loaderDebt",
        "loaderIsInsurance",
        "loaderIsHouseLoad",
        "loaderHouseLoadType",
        "loaderHouseLoadAmount",
        "loaderHouseLoadBank",
        "loaderHouseLoadMouthPay",
        "loaderIsCreditLoad",
        "loaderCreditLoadAmount",
        "loaderCreditLoadBank",
        "loaderCreditLoadMonthPay",
        "loaderIsCar",
        "loaderCarLoadAmount",
        "loaderCarLoadBank",
        "loaderCarLoadMonthPay",
        "loaderIsCreditCard",
        "loaderCreditCardBank",
        "loaderCreditCardUsed",
        "loaderCreditCardLoadLimit",
      ],

      pickerOptions: {
        shortcuts: [
          {
            text: "今天",
            onClick(picker) {
              picker.$emit("pick", new Date());
            },
          },
        ],
      },
    };
  },

  mounted() {},
  created() {
    // console.log(this.$store.state.user.roles);

    this.getList();

    this.getBankList();

    this.getDeptTree();
  },
  methods: {
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 查询部门下拉树结构 */
    getDeptTree() {
      deptTreeSelect().then((response) => {
        this.deptOptions = response.data;
      });
    },
    /** 查询客户信息列表 */
    getList() {
      this.loading = true;
      listCustomer(this.queryParams).then((response) => {
        this.customerList = response.rows;
        this.customerList.map((item, index) => {
          item.loaderStart = parseInt(item.loaderStart);
        });
        console.log(this.customerList);

        this.total = response.total;
        this.loading = false;
      });
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.inputDisable = false;
      this.activeName = "first";
      this.open = true;
      this.title = "添加客户";

      this.form.loaderState = "0";
      this.form.loaderStart = "1";
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        loaderName: null,
        loaderState: null,
        loaderStart: null,
        loaderContactInformation: null,
        loaderIdNumber: null,
        loaderAddress: null,
        loaderAge: null,
        loaderChildAge: null,
        loaderCompany: null,
        loaderCompanyName: null,
        loaderSalary: null,
        loaderHouseFund: null,

        loaderPropertyAddress: [null],
        loaderPropertyAddressArea: [null],
        loaderPropertyCompletedYears: [null],
        loaderPropertyAssess: [null],
        loaderPropertyIsLoad: [null],
        loaderPropertyLoadAmount: [null],
        loaderPropertyLoadBank: [null],

        loaderDebt: [null],
        loaderIsInsurance: [null],

        loaderIsHouseLoad: [null],
        loaderHouseLoadType: [null],
        loaderHouseLoadAmount: [null],
        loaderHouseLoadBank: [null],
        loaderHouseLoadMouthPay: [null],

        loaderIsCreditLoad: [null],
        loaderCreditLoadAmount: [null],
        loaderCreditLoadBank: [null],
        loaderCreditLoadMonthPay: [null],

        loaderIsCar: [null],
        loaderCarLoadAmount: [null],
        loaderCarLoadBank: [null],
        loaderCarLoadMonthPay: [null],

        loaderIsCreditCard: [null],
        loaderCreditCardBank: [null],
        loaderCreditCardUsed: [null],
        loaderCreditCardLoadLimit: [null],

        loaderRemark: null,
        loadFollow: null,
        loadCommission: null,
        loadSource: null,
        loadReminderTime: null,
        loadType: null,
        loadProgress: null,
        loadProgressRecall: null,
        loadReceive: null,
        loadSource: null,
        loadAmount: null,
        loadLife: null,
        loadRepayWay: null,
        loadMonthPay: null,
        loadBank: null,
        loadRepayDay: null,
        loadRepayRecall: null,
        loadRemark: null,
        wifeName: null,
        wifeContactInformation: null,
        wifeIdNumber: null,
        wifeAddress: null,
        wifeAge: null,
        wifeChildAge: null,
        wifeCompany: null,
        wifeCompanyName: null,
        wifeSalary: null,
        wifeHouseFund: null,
        wifePropertyAddress: null,
        wifePropertyAddressArea: null,
        wifePropertyCompletedYears: null,
        wifePropertyAssess: null,
        wifePropertyIsLoad: null,
        wifePropertyLoadAmount: null,
        wifePropertyLoadBank: null,
        wifeDebt: null,
        wifeIsInsurance: null,
        wifeIsCar: null,
        wifeIsCreditLoad: null,
        wifeIsHouseLoad: null,
        wifeIsCreditCard: null,
        wifeHouseLoadType: null,
        wifeHouseLoadAmount: null,
        wifeHouseLoadBank: null,
        wifeHouseLoadMouthPay: null,
        wifeCreditLoadAmount: null,
        wifeCreditLoadBank: null,
        wifeCreditLoadMonthPay: null,
        wifeCarLoadAmount: null,
        wifeCarLoadBank: null,
        wifeCarLoadMonthPay: null,
        wifeCreditCardLoadLimit: null,
        wifeCreditCardBank: null,
        wifeCreditCardUsed: null,
        wifeRemark: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        loadBelongPerson: this.$store.state.user.userId,
        user: {
          userName: this.$store.state.user.name,
        },
        dept: {
          deptName: this.$store.state.user.deptName,
        },
      };
      this.resetForm("form");
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    handleRecover(row) {
      this.reset();
      const id = row.id;
      getCustomer(id).then((response) => {
        this.form = response.data;
        this.form.delFlag = "0";
        this.form.loaderState = "0";
        if (this.form.id != null) {
          updateCustomer(this.form).then((response) => {
            this.$modal.msgSuccess("恢复成功");
            this.getList();
          });
        }
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        for (let index = 0; index < this.array.length; index++) {
          const element = this.array[index];
          this.form[`${element}`] = this[`${element}`].toString();
        }

        if (valid) {
          if (this.form.id != null) {
            updateCustomer(this.form).then((response) => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addCustomer(this.form).then((response) => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        } else {
          this.$modal.msgError("请检查必填项");
        }
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loadBelongDepartmentName = row.dept.deptName;
      this.loadBelongPersonName = row.user.userName;
      this.reset();
      const id = row.id || this.ids;
      getCustomer(id).then((response) => {
        this.form = response.data;

        this.form.loaderStart = parseInt(this.form.loaderStart);

        for (let index = 0; index < this.array.length; index++) {
          const element = this.array[index];
          this[`${element}`] = this.form[`${element}`].split(",");
        }

        this.title = "修改客户信息";
        this.activeName = "first";
        this.open = true;
        this.inputDisable = true;
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除客户信息编号为"' + ids + '"的数据项？')
        .then(function () {
          return delCustomer(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
    },

    addField(name) {
      this[`${name}`].push(null);
    },

    delField(name, index) {
      let delArray = [];
      switch (name) {
        case "loaderPropertyAddress":
          delArray = [
            "loaderPropertyAddress",
            "loaderPropertyAddressArea",
            "loaderPropertyCompletedYears",
            "loaderPropertyAssess",
            "loaderPropertyIsLoad",
            "loaderPropertyLoadAmount",
            "loaderPropertyLoadBank",
          ];
          break;
        case "loaderDebt":
          delArray = ["loaderDebt"];
          break;
        case "loaderIsInsurance":
          delArray = ["loaderIsInsurance"];
          break;
        case "loaderHouseLoadType":
          delArray = [
            "loaderIsHouseLoad",
            "loaderHouseLoadType",
            "loaderHouseLoadAmount",
            "loaderHouseLoadBank",
            "loaderHouseLoadMouthPay",
          ];
          break;
        case "loaderCarLoadAmount":
          delArray = [
            "loaderCarLoadAmount",
            "loaderCarLoadBank",
            "loaderCarLoadMonthPay",
          ];
          break;
        case "loaderCreditCardLoadLimit":
          delArray = [
            "loaderIsCreditCard",
            "loaderCreditCardBank",
            "loaderCreditCardUsed",
            "loaderCreditCardLoadLimit",
          ];
          break;
        case "loaderCreditLoadAmount":
          delArray = [
            "loaderIsCreditLoad",
            "loaderCreditLoadAmount",
            "loaderCreditLoadBank",
            "loaderCreditLoadMonthPay",
          ];
          break;
        default:
          break;
      }

      for (let i = 0; i < delArray.length; i++) {
        const element = delArray[i];
        this[`${element}`].splice(index, 1);
      }

      if (this[`${name}`].length == 0) {
        for (let i = 0; i < delArray.length; i++) {
          const element = delArray[i];
          this[`${element}`].push(null);
        }
      }
    },

    deptChange(node) {
      this.loadBelongPerson = null;
      listUser(
        this.addDateRange(
          {
            deptId: node.id,
          },
          this.dateRange
        ),
        []
      ).then((response) => {
        this.userList = response.rows;
      });
    },
    personChange(node) {
      // console.log(node);
    },
    normalizer(node) {
      return {
        id: node.userId,
        label: node.nickName,
      };
    },
    /** 转换银行参数数据结构 */
    normalizerBank(node) {
      if (node.children && !node.children.length) {
        delete node.children;
      }
      return {
        id: node.bankId,
        label: node.bankName,
        children: node.children,
      };
    },
    submitInserDialog() {
      if (this.loadBelongPerson == null) {
        this.$modal.msgError("未选择客户经理");
      } else {
        listUser(
          this.addDateRange(
            {
              userId: this.loadBelongPerson,
            },
            this.dateRange
          ),
          []
        ).then((response) => {
          if (response.rows) {
            this.form.loadBelongPerson = this.loadBelongPerson;
            this.form.user.userName = response.rows[0].userName;
            this.form.dept.deptName = response.rows[0].dept.deptName;
            this.innerVisible = false;
          }
        });
      }
    },
    getBankList() {
      listBank().then((response) => {
        this.bankOptions = response.rows;
      });
    },
    compareDate(val) {
      const d = this.datedifference(
        this.parseTime(new Date(), "{y}-{m}-{d}"),
        val
      );
      return d;
    },
    datedifference(sDate1, sDate2) {
      //sDate1和sDate2是2006-12-18格式
      let dateSpan, tempDate, iDays;
      sDate1 = Date.parse(sDate1);
      sDate2 = Date.parse(sDate2);
      dateSpan = sDate2 - sDate1;
      iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
      return iDays;
    },
    checkTel(id, sex) {
      if (id != null) {
        getCheckTel(id).then((response) => {
          switch (sex) {
            case 0:
              this.form.wifeContactInformation =
                response.data.wifeContactInformation;
            case 1:
              this.form.loaderContactInformation =
                response.data.loaderContactInformation;
              break;
          }

          this.$modal.msgSuccess("查询成功");
        });
      }
    },
    rowClick(row, e, column) {
      // this.loadBelongDepartmentName = row.dept.deptName;
      // this.loadBelongPersonName = row.user.userName;
      // this.reset();
      // const id = row.id || this.ids;
      // getCustomer(id).then((response) => {
      //   this.form = response.data;
      //   this.form.loaderStart = parseInt(this.form.loaderStart);
      //   for (let index = 0; index < this.array.length; index++) {
      //     const element = this.array[index];
      //     this[`${element}`] = this.form[`${element}`].split(",");
      //   }
      //   this.title = "修改客户信息";
      //   this.activeName = "first";
      //   this.open = true;
      //   this.inputDisable = true;
      // });
    },
  },
};
</script>

<style lang="scss">
.abow_dialog {
  display: flex;
  justify-content: center;
  align-items: Center;
  overflow: hidden;
  .el-dialog {
    margin: 0 auto !important;
    height: 90%;
    .el-dialog__body {
      height: calc(100% - 120px);
      position: relative;
      left: 0;
      top: 0px;
      bottom: 0;
      right: 0;
      padding: 0;
      z-index: 1;
      overflow: hidden;
      overflow-y: auto;
    }
  }
}
.roll-dialog {
  overflow-y: scroll;
  overflow-x: hidden;
  height: 100%;
}

.form-title {
  font-size: 15px;
  color: rgba(64, 139, 254, 0.8);
  padding: 0 0 0px 12px;
  // color: #f56c6c;
  line-height: 20px;
  font-weight: bold;
  margin-top: 10px;
}
.editBelong {
  position: absolute;
  right: 0%;
}
</style>

<style lang="scss" scoped>
.crm {
  .el-form-item {
    margin-bottom: 0px;
  }
}
</style>